﻿using System;
using System.Windows.Forms;

namespace Groove.Winform
{
    public static class ControlInvokeExtension
    {
        public static void DoInvoke(this Control control, Action action)
        {
            if (control.InvokeRequired)
            {
                control.BeginInvoke(new EventHandler((sender, arg) =>
                {
                    action.Invoke();
                }));
                return;
            }
            action.Invoke();
        }
    }
}
